package com.six.vo;

import java.sql.Date;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.MapKey;
import javax.persistence.Table;

/**
 * 用户组
 * 
 */
@Entity
@Table(name="WMS_T_GROUP")
public class Group {
	 private int groupID;// VARCHAR(16) 用户组编号
	 private String groupName;// NVARCHAR2(60) 用户组名称
	 private String groupNote;// NVARCHAR2(200) 描述
	 private Date groupEditTime;// DATE 最后编辑日期
	 private int groupIsDel;// SMALLINT 是否已被删除
	 private Map<String,User>  user=new HashMap<String,User>();
	 private Map<String,Permission>  permission=new HashMap<String,Permission>();
	 
	public Group() {
		super();
	}
	public Group(int groupID, String groupName, String groupNote,
			Date groupEditTime, int groupIsDel, Map<String, User> user,
			Map<String, Permission> permission) {
		super();
		this.groupID = groupID;
		this.groupName = groupName;
		this.groupNote = groupNote;
		this.groupEditTime = groupEditTime;
		this.groupIsDel = groupIsDel;
		this.user = user;
		this.permission = permission;
	}
	@Id
	@GeneratedValue
	public int getGroupID() {
		return groupID;
	}
	public void setGroupID(int groupID) {
		this.groupID = groupID;
	}
	public String getGroupName() {
		return groupName;
	}
	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}
	public String getGroupNote() {
		return groupNote;
	}
	public void setGroupNote(String groupNote) {
		this.groupNote = groupNote;
	}
	public Date getGroupEditTime() {
		return groupEditTime;
	}
	public void setGroupEditTime(Date groupEditTime) {
		this.groupEditTime = groupEditTime;
	}
	public int getGroupIsDel() {
		return groupIsDel;
	}
	public void setGroupIsDel(int groupIsDel) {
		this.groupIsDel = groupIsDel;
	}
	@ManyToMany
	@MapKey(name="userID")
	@JoinTable(
	  name="WMS_T_U_G",
	  joinColumns=@JoinColumn(name="ugGroupId"),
	  inverseJoinColumns=@JoinColumn(name="ugUserId")
	  )
	public Map<String, User> getUser() {
		return user;
	}
	public void setUser(Map<String, User> user) {
		this.user = user;
	}
	@ManyToMany
	@MapKey(name="permID")
	@JoinTable(
	  name="WMS_T_PERM_GROUP",
	  joinColumns=@JoinColumn(name="groupID"),
	  inverseJoinColumns=@JoinColumn(name="permID")
	  )
	public Map<String, Permission> getPermission() {
		return permission;
	}
	public void setPermission(Map<String, Permission> permission) {
		this.permission = permission;
	}
	
	 

}
